<?php
/**
 * Created by PhpStorm.
 * User: qttx
 * Date: 2019/6/1
 * Time: 11:06
 */
namespace app\admin\model;

class ShopTypeModel extends BaseModel
{
    protected $table="xst_shop_type";
    protected $rule = [
        'id' => '',
    ];
    protected $msg = [
        'id' => '',
    ];
    //商铺类型显示
    public function index()
    {
        return $this->paginate(10,false,['query'=>request()->param()]);
    }
    //商铺类型添加
    public function add()
    {
        $name = request()->post('name');
        return $this->insert([
            'name'=>$name
        ]);
    }
    //商铺类型修改
    public function edit()
    {
        $name = request()->post('name');
        $id = request()->post('id');
        return $this->where('id',$id)->update([
            'name'=>$name
        ]);
    }
    //商铺类型修改前的查询
    public function getOneId($id)
    {
        return $this->where('id',$id)->find();
    }
    //商铺类型删除
    public function del()
    {
        $id=request()->post('id');
        return $this->where('id',$id)->delete();
    }
}